package easy;

import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;

/**
 * 2644. 找出可整除性得分最大的整数
 * 创建时间：2024-05-18 00:07
 */
public class 找出可整除性得分最大的整数_2644 {
    static class Solution {
        public int maxDivScore(int[] nums, int[] divisors) {
            Arrays.sort(nums);
            int max = -1, ans = 0;
            for (int d : divisors) {
                int cnt = 0;
                for (int i = nums.length - 1; i >= 0; i--) {
                    int num = nums[i];
                    if (num < d) {
                        break;
                    }
                    if (num % d == 0) {
                        cnt++;
                    }
                }
                if (max < cnt || max == cnt && d < ans) {
                    ans = d;
                    max = cnt;
                }
            }
            return ans;
        }

        public static void main(String[] args) {
            Solution s = new Solution();
            System.out.println(s.maxDivScore(new int[]{1}, new int[]{1000000000}));
        }
    }
}
